{ open Parser }

rule token = parse
  [' ' '\t' '\r' '\n'] { token lexbuf }
| '(' {LPAREN}        | ')' {RPAREN}
| '{' {LBRACE}        | '}' {RBRACE}
| '[' {LSQUA}         | ']' {RSQUA}
| '"' {DQUOTATION}    | '\''{SQUOTATION}
| ',' {COMMA}
| ';' {SEMI}
| '+' { PLUS }
| '-' { MINUS }
| '*' { TIMES }
| '/' { DIVIDE }
| '=' {ASSIGN}
| "int" {INT}
| "string" {STRINGV}
| ['0'-'9']+ as lxm { LITERAL(int_of_string lxm) }
| ['a'-'z' 'A'-'Z']['a'-'z' 'A'-'Z' '0'-'9' '_']* as lxm {ID(lxm)}
| '\'' ['a'-'z' 'A'-'Z' '0'-'9' '_'] '\'' as lxm {CHAR(lxm.[1])}
|'"' ['a'-'z' 'A'-'Z' '0'-'9' '_']* '"' as lxm {STR(lxm)}
| _ as char {raise (Failure("illegal character" ^ Char.escaped char))}
| eof { EOF }
